Changing property or state from inside and outside component